Developer --> Technical Publications

     


Determining the Characteristics of the Video Devices

To determine the characteristics of available video devices, your application can use the DMGetFirstScreenDevice function to obtain a handle to the GDevice structure for the first video device in the device list. The DMGetFirstScreenDevice function is similar to the QuickDraw function GetDeviceList , except that when returning GDevice structures, GetDeviceList does not distinguish between the GDevice structures for video devices and the GDevice structures associated with no video devices. (For example, if system software uses the function DMDisableDisplay to disable the last remaining device in the device list, then DMDisableDisplay inserts into the device list a GDevice structure that is not associated with any video device. The DMGetFirstScreenDevice function will not return this GDevice structure, but GetDeviceList might.)

After using the DMGetFirstScreenDevice function to obtain a handle to the first GDevice structure for a display in the device list, your application can use the DMGetNextScreenDevice function to loop through all of the video devices in the device list. The DMGetNextScreenDevice function is similar to the QuickDraw function GetNextDevice , except that when returning GDevice structures, GetNextDevice does not distinguish between the GDevice structures for video devices and the GDevice structures associated with no video devices.

Another important difference between these two Display Manager functions ( DMGetFirstScreenDevice and DMGetNextScreenDevice ) and their related QuickDraw functions ( GetDeviceList and GetNextDevice ) is that with both Display Manager functions, your application can specify that the Display Manager return handles only to active video devices. (An active device is a video device whose display area is included in the user's desktop; the display area of an inactive device does not appear on the user's desktop.)

To get a handle to the GDevice structure for a video device that mirrors another, your application can use the DMGetNextMirroredDevice function.

Your application can pass the GDevice handle returned for any of these video devices to a QuickDraw function like TestDeviceAttribute or HasDepth to determine various characteristics of the video device, or your application can examine the gdRect field of the GDevice structure to determine the dimensions of the screen it represents.

Macintosh system software uses the DMCheckDisplayMode function to determine whether a video device supports a particular display mode and pixel depth. Typically, your application does not need to know whether a display mode is supported, but only whether a specific pixel depth is supported, in which case your application can use the Color QuickDraw function HasDepth .

To determine whether QuickDraw supports video mirroring on the user's computer system, your application can use the DMQDIsMirroringCapable function. Your application can use the DMCanMirrorNow function to determine whether video mirroring can activate. And to determine whether the user's computer system currently uses video mirroring, your application can use the DMIsMirroringOn function.

Finally, your application can use the DMGetDisplayIDByGDevice function to determine the display ID for a video device. A display ID is a long integer used by the Display Manager to uniquely identify a video device. Associating a display by its display ID is helpful when using functions such as DMRemoveDisplay that could change the GDevice structure associated with a video device. You can first determine the display ID for a device by using the DMGetDisplayIDByGDevice function. To later retrieve that device's GDevice structure after calling various Display Manager functions, your application can use the DMGetGDeviceByDisplayID function. Display IDs are not guaranteed to be persistent across reboots or sleep.


© 2000 Apple Computer, Inc. (Last Updated 07 April 00)